package com.fzkj.hashmap;

import java.util.Map;

public class Node<K, V> implements Map.Entry<K, V> {
    K key;
    V val;
    Node<K, V> next;

    public Node(K key, V val, Node<K, V> next) {
        this.key = key;
        this.val = val;
        this.next = next;
    }

    public Node(K key, V val) {
        this.key = key;
        this.val = val;
        this.next = null;
    }

    @Override
    public final K getKey() {
        return key;
    }

    @Override
    public final V getValue() {
        return val;
    }

    @Override
    public final V setValue(V value) {
        return this.val = value;
    }

    public final String toString(){
        return key + "=" + val;
    }
}
